import random

# 生成100个1到100的升序随机整数
nums = sorted(random.sample(range(1, 101), 100))

def binary_search(nums, target):
    left = 0
    right = len(nums) - 1
    while left <= right:
        mid = (left + right) // 2
        if nums[mid] == target:
            return mid + 1  # 位置从1开始计数
        elif nums[mid] < target:
            left = mid + 1
        else:
            right = mid - 1
    return -1  # 表示未找到

target = int(input("请输入要查找的数字（1-100）："))
position = binary_search(nums, target)
if position != -1:
    print(f"数字{target}在数列中的位置是第{position}位")
else:
    print(f"数列中未找到数字{target}")